package com.github.bitsapling.sapling.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 登录历史记录表
 * </p>
 *
 */
@TableName("login_history")
public class LoginHistory implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 自增主键ID，唯一标识每条登录记录
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 登录用户的ID，外键关联到用户表
     */
    private Long userId;

    /**
     * 登录时间戳，记录用户登录的具体时间
     */
    private LocalDateTime time;

    /**
     * 登录类型（如"web"、"mobile"、"api"等）
     */
    private String type;

    /**
     * 用户登录时使用的IP地址
     */
    private String ipAddress;

    /**
     * 用户登录时使用的浏览器/设备User-Agent信息
     */
    private String userAgent;

    /**
     * 用户登录时的地理位置（城市/国家等）
     */
    private String location;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public LocalDateTime getTime() {
        return time;
    }

    public void setTime(LocalDateTime time) {
        this.time = time;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getIpAddress() {
        return ipAddress;
    }

    public void setIpAddress(String ipAddress) {
        this.ipAddress = ipAddress;
    }

    public String getUserAgent() {
        return userAgent;
    }

    public void setUserAgent(String userAgent) {
        this.userAgent = userAgent;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    @Override
    public String toString() {
        return "LoginHistory{" +
        "id = " + id +
        ", userId = " + userId +
        ", time = " + time +
        ", type = " + type +
        ", ipAddress = " + ipAddress +
        ", userAgent = " + userAgent +
        ", location = " + location +
        "}";
    }
}
